
<h2 class="name">{{lang('my_tasks')}}</h2>


	
<div style="padding:20px 0px;" class="detail btline2 ">

	{{if $model_item['status']==0}}
		<div class="alert alert-warning">not apply audit.</div>
		&nbsp;
		
	{{elseif $model_item['status']==1}}
	<hr>
		{{$this->Html->link(lang('pass audit'), 
							'/partners/authenticate', 
							array( 'class'=> 'btn btn-default btn-warning','escape'=>false,
						)
						);
					}}&nbsp;
			{{$this->Html->link(lang('refuse audit'), 
							'/partners/authenticate', 
							array( 'class'=> 'btn btn-default btn-warning','escape'=>false,
						)
						);
					}}
	
	{{elseif $model_item['status']==2}}
		<div class="alert alert-warning">been refused audit.</div>
		&nbsp;
	{{elseif $model_item['status']==3}}
		<div class="alert alert-warning">passed audit.</div>
		&nbsp;
			
	{{/if}}		

	
	<ul class="nav nav-tabs" role="tablist">
	
	  <li style="margin-left:30px;"><a class="font14" href="{{$this->Html->url('/admin/partners/view/'.$partner_id)}}">Profile</a></li>
	 
	  <li {{if $_REQUEST['status']=='13,14'}}class="active"{{/if}}><a class="font14" href="{{$this->Html->url('/admin/partners/tasks/'.$partner_id)}}?status=13,14">Current Tasking</a></li>
	  <li {{if $_REQUEST['status']=='10,11'}}class="active"{{/if}}><a class="font14" href="{{$this->Html->url('/admin/partners/tasks/'.$partner_id)}}?status=10,11">Bid Tasking</a></li>
	  <li {{if $_REQUEST['status']=='15'}}class="active"{{/if}}><a class="font14" href="{{$this->Html->url('/admin/partners/tasks/'.$partner_id)}}?status=15">Finished Tasks</a></li>
	</ul>
	
	
	{{loop $tasks $task}}
		<div style="margin:30px 30px;" class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">{{$this->Html->link(usubstr($task['Task']['name'],0,24), 
						'/tasks/view/'.$task['Task']['id'], 
						array('title'=>$task['Task']['name'],'target'=>'_blank','escape'=>false)
					);
				}}</h3>
  </div>
  <div class="panel-body">
    	
				<?PHP  $task_id = $task['Task']['id'];$finished_executes = 0; $total_executes = 0;?>
				<portlet list_tpl="inner" id="user-task-plan" portlet="body" cache="no" title="{{lang('tasking_plan')}}" model="TaskExecute" recursive="0" info="limit=12&conditions[task_id]=$task_id&conditions[user_id]=$current_user_id&order=start_date asc">
						<?PHP $total_executes ++;
				if($item_all['TaskExecute']['status'] >= 2){
					$finished_executes ++ ;
				}
					 ?>
				</portlet>
				<?PHP if($total_executes){ $step_progress = ceil($finished_executes*100/$total_executes);} ?>
				<div class="bbline1"><!--detail-0 start-->
              <table class="table4">
                <tbody>
                <tr>
                  <td style="width:10%" class="th1">Progress:</td>
                  <td style="text-align:center; width:10%" class="th1">{{$step_progress}}%</td>
                  <td>
                    <div class="progress nomb">
                      <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: {{$step_progress}}%">
                        <span class="sr-only"></span>
                      </div>
                    </div>
                  </td>
                </tr>
                <tr>
                      <td></td>
                      <td></td>
                      <td style="padding:5px 0px;">
                        <div class="guard fl">
                          <div class="lineleft"></div>
                          <div class="start1"><span class="ing">Start</span><span class="time">2013.4.2</span></div>
                        </div> 
                        <div class="guard fl">
                          <div class="lineleft"></div>
                          <div class="start1"><span class="ing">Phase One</span><span class="time">{{$item_all['TaskExecute']['end_date']}}</span></div>
                        </div> 
                        <div class="guard fl">
                          <div class="lineleft"></div>
                          <div class="start1"><span class="ing">Phase Twe</span><span class="time">2013.4.2</span></div>
                        </div> 
                        <div class="guard fl">
                          <div class="lineleft"></div>
                          <div class="start1"><span class="ing">End</span><span class="time">2013.4.2</span></div>
                        </div>   
                      </td>
                    </tr>
              </tbody></table>
			</div>
			<table class="table">
			<tr><td>
				<p style="height:16px;"><small><strong>Time period:</strong> {{substr($task['Task']['start_time'],0,10)}} ~ {{substr($task['Task']['end_time'],0,10)}}</small></p>
				</td>
				<td style="width:180px;">
				{{$task['Task']['price_des']}}
				</td>		
				</tr>
				<tr>
				<td colspan="2">
				{{$task['Task']['content']}}
				
				{{if $step_progress==100}}
		       		<div>
		       			{{if $task['Tasking']['status'] == 14}}
			       			<a class="btn btn-primary" href="{{$this->Html->url('/tasks/finished/'.$task['Task']['id'].'/'.$task['Tasking']['id'])}}">{{lang('finished_task')}}</a>
			       		{{elseif $task['Tasking']['status'] == 15}}
			       			{{lang('finished,wait confirm.')}}
			       		{{elseif $task['Tasking']['status'] == 16}}
			       			{{lang('confirm_finished')}}
			       		{{/if}}
		       		</div>
		       	{{/if}}
		       
				</td>
				</tr>
			<tr><td colspan="2">
				{{loop $data_array $item_all}}
					<div>
					<h3 style="padding:10px 0px; font-size:18px;">{{$item_all['TaskExecute']['name']}}</h3>
					<?php $progress = get_time_process($item_all['TaskExecute']['start_date'],$item_all['TaskExecute']['end_date']);  ?>
					<div class="progress nomb">
                      <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: {{$progress}}%">
                        <span class="sr-only"></span>
                      </div>
                    </div>
                    
					<div>
		                  <strong>Time period:</strong> {{$item_all['TaskExecute']['start_date']}} ~ {{$item_all['TaskExecute']['end_date']}}
		                  	<!-- <div class="col-md-6"><strong>progress rate:</strong> Report Solution</div> -->
		            </div>
		            </div>
				{{/loop}}
			</td></tr>
				
		</table>
  </div>
</div>
	
				
	{{/loop}}
	
</div>
			
	




